<template>
	<view>
		<web-view :src="pageUrl" @message="message"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageUrl: ''
			}
		},
		onLoad(option) {
			// https://miniprogram-kyc.tencentcloudapi.com/api/web/login?appId=IDAfndk9
			//&version=1.0.0
			//&orderNo=AS411523199211204511747991447060
			//&userId=411523199211204514
			//&sign=B8F4C352E30BCF915A7C2182C94D6D4556314D9F
			//&nonce=uXvpv7DcQGJL2UHPQaRr67DJ0Re92ArA
			//&h5faceId=tx0038c3d0ae4219e55773704007e220
			//&url=https%3A%2F%2Fprev.asign.cn%2Fauth%2Fface%2Fredirect%2FPA10320250523171047003636
			//&resultType=1
			//&from=browser
			
			//https://kyc.qcloud.com/s/web/h5/?appId=IDAfndk9
			//&version=1.0.0
			//&orderNo=AS411523199211204511747993083824
			//&userId=411523199211204514
			//&sign=F59385DDA94E2A0A1FC6CD330B956593119A8BAC
			//&faceId=tx00beb88dccedb0cad2c7ddca07e220
			console.log("option ==> {}", option);
			this.pageUrl = option.pageUrl+"&version="+option.version+"&orderNo="+option.orderNo+"&userId="+option.userId+"&sign="+option.sign+"&faceId="+option.faceId//"&nonce="+option.nonce+"&h5faceId="+option.h5faceId+"&url="+option.url+"&resultType="+option.resultType+"&from="+option.from
			console.log("this.pageUrl ==> {}", this.pageUrl);
		},
		methods: {
			// // web环境，使用iframe打开爱签H5认证页面，回调方法。（iframe使用message事件） 
			// // 爱签网页端向iframe端传递消息  
			// window.parent.postMessage(JSON.stringify(data), '*');  
			// // 贵司iframe端接受网页端传过来的消息  
			// window.addEventListener('message', function(event) { 
			//    console.log('收到消息', event)  
			// })  
			message(){
				console.log('收到消息', event)
			},
		}
	}
</script>

<style>

</style>
